const Koa=require('koa');
const cors=require('koa-cors');
const Router=require('koa-router');
const bodyParser=require('koa-bodyparser');
const app=new Koa();
const router=new Router();
app.use(cors());
app.use(bodyParser());
let data=[
    {
        "message": "ok",
        "data": {
            "result": [
                {
                    "grid": {
                        "left": "3%",
                        "right": "4%",
                        "bottom": "3%",
                        "containLabel": true
                    },
                    "legend": {
                        "data": [
                            "运动区",
                            "生活区",
                            "教学区",
                            "办公区",
                            "试验区"
                        ],
                        "left": "20%",
                        "top": "5%"
                    },
                    "xAxis": {
                        "type": "category",
                        "boundaryGap": false,
                        "data": [
                            "1000",
                            "60",
                            "100",
                            "1022",
                            "102",
                            "14",
                            "16",
                            "18",
                            "20",
                            "22"
                        ]
                    },
                    "series": [
                        {
                            "name": "运动区",
                            "type": "line",
                            "stack": "Total",
                            "data": [
                                4,
                                6,
                                8,
                                10,
                                12,
                                14,
                                16,
                                18,
                                20,
                                22
                            ]
                        },
                        {
                            "name": "生活区",
                            "type": "line",
                            "stack": "Total",
                            "data": [
                                4,
                                6,
                                8,
                                10,
                                12,
                                14,
                                16,
                                18,
                                20,
                                22
                            ]
                        },
                        {
                            "name": "教学区",
                            "type": "line",
                            "stack": "Total",
                            "data": [
                                98,
                                6,
                                8,
                                10,
                                12,
                                14,
                                16,
                                18,
                                20,
                                22
                            ]
                        },
                        {
                            "name": "办公区",
                            "type": "line",
                            "stack": "Total",
                            "data": [
                                0,
                                6,
                                8,
                                10,
                                12,
                                14,
                                16,
                                18,
                                20,
                                22
                            ]
                        },
                        {
                            "name": "试验区",
                            "type": "line",
                            "stack": "Total",
                            "data": [
                                0,
                                6,
                                8,
                                10,
                                12,
                                14,
                                16,
                                18,
                                20,
                                22
                            ]
                        }
                    ]
                }
            ]
        },
        "code": 200
    }
]
router.get('/getlist/kist',ctx=>{
    ctx.body={
        code:200,
        msg:'获取成功',
        data
    }
})

app.use(router)

app.listen(3000,()=>{
    console.log('服务器启动成功');
})